#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QPushButton>
#include <QLineEdit>
#include <QLabel>
#include <QTextEdit>
#include "QAction"

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
public:
    QLabel *label1;
    QLabel *label2;

    QTextEdit *showEdit;
    QTextEdit *resultEdit;

    //QPushButton *backBt;
    QPushButton *removeBt;
    QPushButton *clearBt;
    QPushButton *sumBt;

    QPushButton *sevenBt;
    QPushButton *eightBt;
    QPushButton *nineBt;
    QPushButton *decBt;

    QPushButton *fourBt;
    QPushButton *fiveBt;
    QPushButton *sixBt;
    QPushButton *mulBt;

    QPushButton *oneBt;
    QPushButton *twoBt;
    QPushButton *threeBt;
    QPushButton *divBt;

    //QPushButton *_Bt;
    QPushButton *zeroBt;
    QPushButton *pointBt;
    QPushButton *equalBt;

    qreal result;
    qreal firstOpeNum;
    qreal secondOpeNum;
    QString contextStr;
    int operat = 0;
    int edittext;
    int const ADD = 1;
    int const DEC = 2;
    int const MUL = 3;
    int const DIV = 4;

public:
    void mylayout();
    void JudgeZero();
    void BeforeOperator(int iOperator);
    void init();
    void keyPressEvent(QKeyEvent *e);

private slots:
    //void onPushBtBack();
    void onPushBtRemove();
    void onPushBtClear();
    void onPushBtSum();
    void onPushBtSeven();
    void onPushBtEight();
    void onPushBtNine();
    void onPushBtDec();
    void onPushBtFour();
    void onPushBtFive();
    void onPushBtSix();
    void onPushBtMul();
    void onPushBtOne();
    void onPushBtTwo();
    void onPushBtThree();
    void onPushBtDiv();
    //void onPushBtSign();
    void onPushBtPoint();
    void onPushBtZero();
    void onPushBtEqual();



private:
    Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H
